const path = require('path');

function resolve(dir) {
    return path.join(__dirname, dir);
}

module.exports = {
    chainWebpack: (config) => {
        // 配置别名
        config.resolve.alias
            .set('@', resolve('src'))
            .set('@assets', resolve('src/assets'))
            .set('@images', resolve('src/assets/images'))
            .set('@stylesheets', resolve('src/assets/stylesheets'))
            .set('@components', resolve('src/components'))
            .set('@directives', resolve('src/directives'))
            .set('@filters', resolve('src/filters'))
            .set('@plugins', resolve('src/plugins'))
            .set('@store', resolve('src/store'))
            .set('@views', resolve('src/views'))
            .set('@layouts', resolve('src/layouts'))
            .set('@helpers', resolve('src/helpers'))
            .set('@router', resolve('src/router'));

        // 修改标题名称
        config.plugin('html').tap((args) => {
            args[0].title = 'VUE项目模板';
            return args;
        });
    }
};
